package xyz.chaobei;

/**
 * @copyright (C), 2015-2020
 * @fileName: MovingAverage
 * @author: MRC
 * @date: 2021/1/8 7:18
 * @description:
 */
public class MovingAverage {

    private int count;

    private double sum;

    public MovingAverage(int count, double sum) {
        this.count = count;
        this.sum = sum;
    }
    public void submit(int a) {
        this.count += a;
        this.sum += a;
    }
    public double add() {
        return this.count + this.sum;
    }

    public double avg() {
        return this.sum / this.count;
    }


}
